package cn.com.hhrcw.utils.resume;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

/**
 * <p>
 * 生成html  * 版的简历（2022年4月1日10:45:55 zhf 抽离出来，原来所在是ICvResumeService 代码 太长 ）
 * </p>
 *
 * @author jiangdong
 * @since 2020-10-29
 */

@Transactional(rollbackFor = Exception.class)
@Slf4j
@Component
public class TransNameUtil {
    @Autowired
    private JdbcTemplate jdbcTemplate;

    public String getTransName(String table, String code, String column, String columnValue) {
        try {
            return jdbcTemplate.queryForObject("select " + columnValue + " from `" + table + "` where " + column + " = ?", new Object[]{code}, String.class);
        } catch (Exception e) {
            log.warn("城市数据提前错误：", code);
            return "";
        }
    }
}
